local fileName = string.getModeName(...)
local ClassRef = class(fileName, app.mvc.ViewBase)

ClassRef.VIEW_ROOT_RES = Res.LoginCodeScene

function ClassRef:init()
    self:setContentSize(display.size)
    self:setTouchEnabled(true)
    self:setSwallowTouches(true)

    self:setBackGroundColor(display.COLOR_BLACK)
    self:setBackGroundColorOpacity(179)
    self:setBackGroundColorType(1)
    
    self._ui.Button_back:addClickEventListener(function()
    	executeFunc(self._onOperate, "closeView")
    end)

    self._ui.Button_quxiao:addClickEventListener(function()
    	executeFunc(self._onOperate, "getCode")
    end)

    self._ui.Button_queding:addClickEventListener(function()
        local str = self._editText:getText()
        if #str > 0 then
    	    executeFunc(self._onOperate, "useCode", str)
        else
            display.pushToast(L("tips_3000303"))
        end
    end)

	self._editText = display.replaceTextFieldWithEditBox(self._ui.TextField, nil, true)

    -- for test
    self._ui.Button_quxiao:setVisible(false)
    self._ui.Button_queding:setPositionX(243)
end

function ClassRef:clearText()
    self._editText:setText("")
end

return ClassRef